﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LongQuanWeb.App_Code;
using System.Data;

namespace LongQuanWeb.Homes
{
    public partial class News : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //SubCategoryType :1 活动展示
                string strSql = "select count(*) from [Activity] Where SubCategoryType='1'";
                AspNetPager1.RecordCount = int.Parse(DbHelperSQL.Query(strSql).Tables[0].Rows[0][0].ToString());
                BindRpt();
            }
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindRpt();
        }

        private void BindRpt()
        {
            string strSql = "select * from [Activity] Where SubCategoryType='1' Order By AcitivityNum Desc";
            DataTable dt = DbHelperSQL.GetListDataSet(AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, strSql);
            this.rpt_active.DataSource = dt;
            this.rpt_active.DataBind();
        }
    }
}
